/**
 * 
 */
package com.dfhc.pub.single;

import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;



/**
 * @author longsebo
 *
 */
public class FileLockMap {
	private static FileLockMap fileLockMap;
	private Map<String,InputStream> streamMap;
	private FileLockMap(){
		streamMap = new HashMap<String,InputStream>();
	}
	/**
	 * 获取单例
	 * @return
	 */
	public static synchronized FileLockMap getSingleton(){
		if(fileLockMap==null){
			fileLockMap = new FileLockMap();
		}
		return fileLockMap;
	}
	/**
	 * 放入
	 * @param jsguid
	 * @param instream
	 */
	public void put(String jsguid,InputStream instream){
		synchronized (streamMap) {
			streamMap.put(jsguid, instream);
		}
	}
	/**
	 * 删除
	 * @param jsguid
	 * @return
	 */
	public InputStream remove(String jsguid){
		synchronized (streamMap) {
			return streamMap.remove(jsguid);
		}
	}
}
